#
#       Convert.ClearCase.sh
#
#       SNiFF+ V3.0
#
#       Copyright (C) 1998 TakeFive Software GmbH
#       Salzburg, Austria (e-mail: sniff@TakeFive.co.at)
#
#       Author: Max Weninger
#
#       Shell script produce SNiFF+ SymbolList from ClearCase
#       

line=0
ver=0
depthHist=1
histName=""
depth=0
br=0
allName=""


lfnr=0;
while read line
do
	type=`echo "$line" | cut -d" " -f7`
#without config support
	verPath=`echo "$line" | cut -d" " -f2`
	ver=1.$lfnr
	
	if [ "$type" != "branch" ]
	then	
		label=`echo $line | cut -d" " -f6`
		if [ "$label" != "_NO_LABEL_" ] 
		then
			echo "$label: $ver" 
		else 	
			date=`echo "$line"|awk '{ printf" 19%s/%s/%s %s; %s; +1 -1;\n",substr($4,7,2),substr($4,0,2),substr($4,4,2),$5,$3}'`
			if [ $lfnr = 0 ]
			then
				full_date="$verPath $ver$date"
			else
				full_date="$full_date\n$verPath $ver$date"
			fi
			lfnr=`expr $lfnr + 1`
		fi
	fi
done

echo "HEAD: $ver"
echo "$full_date"
